package com.hedl.studyandjava8.java8_flow.practice;

import com.hedl.studyandjava8.java8_flow.entity.Transaction;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static java.util.stream.Collectors.groupingBy;

/**
 * @author Big Watermelon
 * @description
 * @date 2024/02/16/19:27
 */
public class StudyFlow {

    public static void main(String[] args) {
        Transaction transaction;
        List<Transaction> list = new ArrayList<>();

        for (int i = 0; i <= 10; i++){
            transaction = new Transaction("苹果"+i,100+i);
            list.add(transaction);
        }


        Map<String, List<Transaction>> collect = list.stream().filter((Transaction t) -> t.getSum() >= 100).collect(groupingBy(Transaction::getName));

        System.out.println(collect);
    }
}
